mod errors;
mod models;
mod tests;
mod utils;
mod vue_parser;
use crate::errors::MyResult;
use crate::utils::{init, Data};
use tokio::task;

#[tokio::main]
async fn main() -> MyResult<()> {
    let config = Data::load_config("./example.json")?;

    let pages = config.pages.clone();
    let components = config.components.clone();
    init::init_project_base(&config.project_base)?;
    init::init_mixin_folder()?;
    init::init_module_folders(&pages.clone().try_into()?)?;
    let _ = tokio::try_join!(
        task::spawn(async move { init::init_pages(&pages).await }),
        task::spawn(async move { init::init_components(&components).await })
    )?;
    init::config_templates(&config)?;
    init::config_components(&config)?;
    Ok(())
}
